3.1 Three in one. Describe how you could use a single array to implement three stacks.
3.2 Stack min. How would you design a stack which, in addition to push and pop, has a function min which returns the minimum element? Push, pop, and min should all operate in 0(1) time.
3.3 Stack of plates. Imagine a literal stack of plates. If the stack gets too high, it might topple. Therefore, in real life, we would likely start a new stack when the previous stack exceeds some threshold. Implement a data structure setOfStacks the mimics this. SetofStacks, should be composed of several stacsk and should create a new stack once the previous one exceeds capacity. SetOfstacks.push() and setOfStacks.pop() should behave identically to a single stack that, pop() should return the same values as it would if there were just a single stack. Follow up. Implement a function popAt(int index) which performs a pop operation on a specific sub-stack.
3.4 Queue via Stacks. Implement a myQueue class which implements a queue using two stacks
3.5 Sort Stack. Write a program to sort a stack such that the smallest items are on the top. You can use an additional temporary stack, but you may not copy the elements into any other data structure. The stacks supports the foloowing operations: push, pop, peek, isEmpty.
3.6 Animal Shelter. An animal shelter, which holds only dogs and cats, operates on a strictly "first in, first out" basis. People must adopt either the oldest of all animals at the shelter, or they can select whether they would prefer a dog or a cat (and will recieve the oldest animal of that type). They cannot select which specific animal they would like. Create the data structures to maintain this system and implement operations usch as enqueue, dequeueAny, dequeueDog, and dequeueCat. You may use the built in linked-list.